 var id = getvl("id");
 var shopids="";
$(function(){
	     if(id!=''){
	     	 shopid(id);
	     	 $("#shangjia").attr("href","24.0.0goodsguanli.html?id="+id);
	     	 $("#xiajia").attr("href","24.0.1goodsguanli_xiajia.html?id="+id);
	     	 $("#shangchuanzhong").attr("href","24.0.2goodsguanli_shangchuanzhong.html?id="+id);
	     }else{
	     	alert("未传入有效值");
	     }
});
   
function shopid(id){
		$.ajax({                   
	   url: urlcore + "/api/shopInfo/selectagno1?id="+id,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				shopids=data.data.id;
				goodsguanli();
				goodsguanli2();
			}
		},
		error:function() {
			alert("error");
		}
	});

}
     
     
var currentPage=1;     
var ss=0;
function goodsguanli(){
	  if(ss!=0 || currentPage==1 || currentPage==2){
		$.ajax({                   
	    url: urlcore + "/api/goods/selectGoodsList?current="+currentPage+"&shopId="+shopids+"&status=1",
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if(data.success == true) {
				ss=data.data.list.length;
				$.each(data.data.list, function(y,n) {
			var goodsguanli='<div class="clearfix tuwen sell_shangpin">'+
'    	<a href="24.3.1goodsguanli_shangjia_detail.html?id='+n.id+'">'+
'	        <div class="tuwen-img fl">'+
'	            <img onerror="errorImg(this)" src="'+n.coverUrl+'" width="75" height="75">'+
'	        </div>'+
'	        <div class="tuwen-wenzi">'+
'	            <h5 class="wuye_h01">'+n.goodsTitle+'</h5>'+
'	            <div class="wuye_div02">&yen;'+n.packPrice+'-&yen;'+n.tradePrice+'</div>'+
'	            <div class="clearfix sell_shangpin_xia">'+
'	            	已售出'+n.saleNum+'件<span>'+n.lookTime+'次浏览</span>'+
'	            </div>'+
'	        </div>'+
'        </a>'+
'    </div>';
            $("#goodsguanli").append(goodsguanli);					
				});
			}
		},
		error:function() {
			alert("error");
		}
	});
	
	}
}



    function bianjis(){
    	if(id!=''){
    		 $("#bianji").attr("href","24.3.0goodsguanli_bianjia_shangjia.html?shopids="+shopids+"&s=");
    	}else{
//     		 /alert("未传入有效值。");
    	}

      }

function goodsguanli2(){
		$.ajax({                   
	   url: urlcore + "/api/goods/theshelves?shopid="+shopids,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				var goodssj=data.data.GOODSSJ;
				var goodscz=data.data.GOODSCZ;
				var goodsxj=data.data.GOODSXJ;
				$("#shangjia").text("上架("+goodssj+")");
				$("#xiajia").text("下架("+goodsxj+")");
				$("#shangchuanzhong").text("上传中("+goodscz+")");
			}
		},
		error:function() {
			alert("error");
		}
	});
}






